package com.itheima.excel_demo.controller;

import com.itheima.excel_demo.service.ExcelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.Map;

@RestController
public class ExcelController {

    @Autowired
    private ExcelService excelService;

    @PostMapping("/upload")
    public String uploadFile(@RequestParam("file") MultipartFile file) {
        Map<String, Integer> stringIntegerMap = excelService.parseExcel(file);
        return stringIntegerMap.toString();
    }
}
